# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="2"

inherit eutils qt4 flag-o-matic
MY_PN="${PN/-/}"

DESCRIPTION="Crypto plugin for qutIM"
HOMEPAGE="http://www.qutim.org"
LICENSE="GPL-2"
SRC_URI="http://www.svtdpi.com.ua/sqee/qutim/plugins/${PN}-${PV}.zip"

SLOT="0"
KEYWORDS="~amd64 ~ppc ~ppc64 ~x86"
IUSE="debug"

IUSE="${IUSE} linguas_ru"

RDEPEND=">=net-im/qutim-0.2"

DEPEND="${RDEPEND}"

RESTRICT="mirror
	debug? ( strip )"

S="${WORKDIR}/${PN}"

src_unpack()
{
	unpack ${A}
	cd ${S}

	# Локализация
	mkdir languages
	if ( use linguas_ru ) ; then
		mkdir languages/ru_RU
		mv qutimcoder_ru.qm languages/ru_RU
	fi
}

src_prepare()
{
	if (use debug) ; then
		unset CFLAGS CXXFLAGS
		append-flags -O1 -g -ggdb
	fi
}

src_compile() 
{
	eqmake4 ${MY_PN}.pro || die "configure plugin filed"
	emake || die "make plugin failed"
}

src_install()
{
	insinto /usr/$(get_libdir)/qutim
	doins "${S}/lib${MY_PN}.so" || die "Plugin installation failed"

	dodir /usr/share/qutim/
	mv ${S}/languages ${D}/usr/share/qutim || die "Translations install filed"
}
